//
//  CBPeripheral+YYConnectedPeripheral.m
//  优悦一族
//
//  Created by liang on 2017/4/12.
//  Copyright © 2017年 umed. All rights reserved.
//

#import "CBPeripheral+YYConnectedPeripheral.h"
#import <objc/runtime.h>
const char *conn;

@implementation CBPeripheral (YYConnectedPeripheral)

- (void)setConnected:(BOOL)connected {
    
    NSNumber *yes;
    if (connected)
        yes = @(1);
     else
        yes = @(0);
    if (!objc_getAssociatedObject(self, conn)) {
        
        objc_setAssociatedObject(self, conn, yes, OBJC_ASSOCIATION_ASSIGN);
    }
}

- (BOOL)connected {
    
    NSNumber *yes = objc_getAssociatedObject(self, conn);
    if (yes.integerValue == 1) {
        
        return YES;
    } else
        return NO;
    
}


@end
